<?php

include_once("connexion.php");

$_SESSION['url'] = 'reservation.php';

if (!isset($_SESSION["userId"])){
	header("location:authentification.php");
}

$query = "SELECT location.debut_location, location.fin_location, type.type, ville.ville, pays.pays, location.tarif_total, location.id
		  FROM location, type, logement, ville, pays
		  WHERE ville.id = logement.id_ville AND pays.id = ville.id_pays AND type.id = logement.id_type AND location.id_logement = logement.id AND location.id_loueur = '".$_SESSION['userId']."'";
		  
	$resultat = mysqli_query($connexion, $query);
		

if(isset($_POST['annuler'])){
	
	$query = "DELETE FROM location WHERE location.id = '".$_POST['id_location']."'";
	
	$suppression = mysqli_query($connexion, $query);
	
	header("location:".$_SESSION['url']);
}	
		
include_once("banniere.html");
include_once("reservation.html");
include_once("footer.html");

?>